Comparing inspection scores across NYC boroughs
rest_inspec_plot1 =
rest_inspec |>
filter(
!is.na(score),
!is.na(boro),
boro != "Missing"
) |>
plot_ly(x = ~boro, y = ~score, type = 'box') |>
layout(
title = "Inspection Scores by Borough",
xaxis = list(title = "Borough"),
yaxis = list(title = "Inspection Score"),
subtitle = "Comparing inspection scores across NYC boroughs"
)
rest_inspec_plot1
## Warning: 'layout' objects don't have these attributes: 'subtitle'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'smith', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
Number of Restaurant Inspections Over Time
rest_inspec_plot3 =
rest_inspec |>
mutate(
year_month = cut(inspection_date, breaks = "month")
) |>
count(year_month) |>
plot_ly(
x = ~year_month,
y = ~n,
type = "scatter",
mode = "lines+markers"
) |>
layout(
title = "Number of Restaurant Inspections Over Time",
xaxis = list(title = "Date"),
yaxis = list(title = "Number of Inspections")
)
rest_inspec_plot3